[HEADER]
	VERSION		00.00.00.00
	DESCRIPTION Reflections from a Cubemap Example
	COPYRIGHT	Imagination Technologies Ltd.
[/HEADER]

[TEXTURES]
	FILE	cubemap 		cubemap.pvr			LINEAR-NEAREST-LINEAR
[/TEXTURES]

[VERTEXSHADER]
	NAME myVertShader
	[GLSL_CODE]
		attribute highp vec4	myVertex;
		attribute mediump vec3	myNormal;
		uniform mediump mat4	myMVPMatrix;
		uniform mediump mat3	myModelViewIT;
		uniform mediump mat3	myViewIT;
		varying mediump vec3	reflectVec;
		void main(void)
		{
			mediump vec3  EyeDir;
			mediump vec3  Normal;

			gl_Position = myMVPMatrix * myVertex;
			Normal = normalize(myModelViewIT * myNormal);
			EyeDir = -vec3(gl_Position);
			reflectVec = normalize(myViewIT*reflect(EyeDir, Normal));
		}
	[/GLSL_CODE]
[/VERTEXSHADER]

[FRAGMENTSHADER]
	NAME myFragShader
	[GLSL_CODE]
		uniform samplerCube myCubeMap;
		varying mediump vec3 reflectVec;
		void main (void)
		{
			mediump vec3 envColour = vec3(textureCube(myCubeMap, reflectVec));
			gl_FragColor = vec4 (envColour, 1.0);
		}
	[/GLSL_CODE]
[/FRAGMENTSHADER]

[EFFECT]
	NAME myEffect

	ATTRIBUTE	myVertex			POSITION
	ATTRIBUTE	myNormal			NORMAL
	UNIFORM		myMVPMatrix			WORLDVIEWPROJECTION
	UNIFORM		myModelViewIT		WORLDVIEWIT
	UNIFORM		myViewIT			VIEWIT
	UNIFORM		myCubeMap			TEXTURE

	TEXTURE 0 cubemap

	VERTEXSHADER myVertShader
	FRAGMENTSHADER myFragShader
[/EFFECT]
